/* 
 * File:   InstantReplayThread.h
 * Author: jcrada
 *
 * Created on May 20, 2009, 11:46 AM
 */

#ifndef _INSTANTREPLAYTHREAD_H
#define	_INSTANTREPLAYTHREAD_H
#include "EvolutiveSimulationThread.h"

namespace jcrada {

    class InstantReplayThread : public EvolutiveSimulationThread {
    private:
        std::vector<Creature*> _creatures;
        int _evaluation_time;
    public:
        InstantReplayThread(int evaluation_time);
        virtual ~InstantReplayThread();

        virtual void addCreature(Creature& creature){
            _creatures.push_back(&creature);
        }

        virtual void removeAllCreatures(){
            for (int i = 0 ; i < _creatures.size(); ++i){
                delete _creatures.at(i);
            }
            _creatures.clear();
        }

        virtual void iterate();
        virtual void run();

        virtual int getEvaluationTime() const {
            return this->_evaluation_time;
        }

        virtual void setEvaluationTime(int evaluation_time) {
            this->_evaluation_time = evaluation_time;
        }

    };
}

#endif	/* _INSTANTREPLAYTHREAD_H */

